<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
	<title></title>
</head>
<body>

</body>
<script type="text/javascript">
    var array = [1,2,1,3,2,3,5];
	var n = []; //一个新的临时数组
	//遍历当前数组
	for(var i = 0; i < array.length; i++){
	//如果当前数组的第i已经保存进了临时数组，那么跳过，
	//否则把当前项push到临时数组里面
	  if (n.indexOf(array[i]) == -1);
	  n.push(array[i]);
	}
    alert(n);


    // 兼容indexOf
      if (!Array.prototype.indexOf){
	  // 新增indexOf方法
	  Array.prototype.indexOf = function(item){
	    var result = -1, a_item = null;
	    if (this.length == 0){
	      return result;
	    }
	    for(var i = 0, len = this.length; i < len; i++){
	      a_item = this[i];
	      if (a_item === item){
	        result = i;
	        break;
	      }  
	    }
	    return result;
	  }
	}
</script>
</html>